<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class NewsAndEvents extends CI_Controller {
	
	 public function __construct()
	    {
	        parent::__construct();
	        session_start();
        	$this->output->enable_profiler(FALSE);
	        
        	$data['news_query'] = $this->MNews->getAllActiveNews();
        	$data['events_query'] = $this->MEvent->getAllActiveEvents();
			$this->load->vars($data);
	    }
	    
	public function index()
	{
		$data['title'] = "News and Events";
		$data['main'] = 'site/home';
		$data['right'] = 'site/news_and_events';
		$this->load->vars($data);
		$this->load->view('site/template');
	}
	
	function news($path){
	    $page = $this->MNews->getNewsPath($path);
		$data['main'] = 'site/news_and_events';
		$data['title'] = $page['title'];
		$data['right'] = 'site/resources_and_lecturers';
		$data['page'] = $page;
		$this->load->vars($data);
		$this->load->view('site/template'); 
  	}
	
  	function events($path){
	    $page = $this->MEvent->getEventPath($path);
		$data['main'] = 'site/news_and_events';
		$data['title'] = $page['title'];
		$data['right'] = 'site/resources_and_lecturers';
		$data['page'] = $page;
		$this->load->vars($data);
		$this->load->view('site/template'); 
  	}
	
}
